home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / egenvalu < prev    next >
Text File  |  1995-03-31  |  2KB  |  71 lines

  1. Article 2295 of comp.sys.handhelds:
  2. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!emory!ogicse!orstcs!prism!jacobsd
  3. From: jacobsd@prism.cs.orst.edu (Dana Jacobsen)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: Eigenvalue program
  6. Summary: program to calculate eigenvalues
  7. Keywords: eigenvalues matrix
  8. Message-ID: <jacobsd.658399946@prism>
  9. Date: 12 Nov 90 08:52:26 GMT
  10. Sender: usenet@orstcs.CS.ORST.EDU
  11. Lines: 56
  12.  
  13.  
  14.  
  15. EIGVAL is a program I wrote that calculates eigenvalues.  It takes a matrix,
  16. and returns the eigenvalues (n eigenvalues for a n by n matrix).  It is not
  17. the most efficient algorithm, but it works.  I took the algorithm from the
  18. book "HP28 Step-by-Step Solutions: Vectors and Matrices."  Eventually I'll
  19. do an eigenvector program.
  20.   Sorry, but I don't have a cable for my 48, so I just typed this in.  Maybe
  21. next time.
  22.  
  23. <<
  24.   DUP DUP SIZE 1 GET
  25.   -> t g n
  26.   <<
  27.     { } 
  28.     1 n START
  29.         0 1 n FOR i
  30.               t i DUP
  31.               2 ->LIST GET
  32.           +
  33.         NEXT
  34.         1 ->LIST
  35.         + 't' g STO*
  36.     NEXT
  37.     -> b
  38.     <<
  39.       { 1 }
  40.       1 n FOR i
  41.       -> s
  42.       <<
  43.         0 1 i FOR j
  44.           b j GET
  45.           s i j - 1 + GET
  46.           * -
  47.         NEXT
  48.         i /
  49.         1 ->LIST s SWAP +
  50.       >>
  51.       NEXT
  52.     >>
  53.   >>
  54.   PROOT
  55. >>
  56.  
  57.  
  58. PROOT is a program that takes a polynomial in a list ( "2*x^2 + 3^x - 2" would
  59. be {2 3 -2}) and returns it's roots.  The version I have calls BAIRS repeatedly
  60. until it can factor quadratics.  This should be available elsewhere.
  61.  
  62. --
  63. Dana Jacobsen                 Oregon State University
  64. jacobsd@cs.orst.edu            Computer Science Department
  65. Dana Jacobsen                       Oregon State University
  66. jacobsd@cs.orst.edu                   Computer Science
  67. .!hplabs!hp-pcd!orstcs!jacobsd
  68. Dana_Jacobsen@RPITSMTS.BITNET            `Once a daemon, always a daemon'
  69.  
  70.  
  71.